﻿namespace AbpPlus.Bus
{
	using System.Threading.Tasks;

	using AbpPlus.Commands;
	using AbpPlus.Events;

	/// <summary>
	/// The MediatorHandler interface.
	/// </summary>
	public interface IMediatorHandler
	{
		/// <summary>
		/// The send command.
		/// </summary>
		/// <param name="command">
		/// The command.
		/// </param>
		/// <typeparam name="T">
		/// </typeparam>
		/// <returns>
		/// The <see cref="Task"/>.
		/// </returns>
		Task SendCommand<T>(T command) where T : Command;
		
		/// <summary>
		/// The send.
		/// </summary>
		/// <param name="command">
		/// The command.
		/// </param>
		/// <typeparam name="TCommand">
		/// </typeparam>
		/// <typeparam name="TCommandResult">
		/// </typeparam>
		/// <returns>
		/// The <see cref="Task"/>.
		/// </returns>
		Task<TCommandResult> SendWithResult<TCommand, TCommandResult>(
			TCommand command)
			where TCommand : Command<TCommandResult>;

		/// <summary>
		/// The raise event.
		/// </summary>
		/// <param name="event">
		/// The event.
		/// </param>
		/// <typeparam name="T">
		/// </typeparam>
		/// <returns>
		/// The <see cref="Task"/>.
		/// </returns>
		Task RaiseEvent<T>(T @event) where T : Event;
	}
}